# -*- coding: utf-8 -*-
from flask import jsonify
from common.error_code import ErrorCode

def success(data=None):
    return jsonify({
        "code": ErrorCode.SUCCESS,
        "msg": "成功",
        "content": data
    })

def error(code, message):
    httpCode = code if code == ErrorCode.UNAUTHORIZED else 200
    return jsonify({
        "code": code,
        "msg": message,
        "content": None
    }), httpCode